<template>
	<view class="page solid-top">
		<!-- <view class="padding">
			{{i18n['APP打开时']}}
		</view> -->
		<view class=" margin-lr margin-top  padding-sm bg-white radius-16  flex align-center justify-between">
			<view class="">
				<view class="text-bold text-333 word-wrap">个性化内容推荐</view>
				<view class="text-sm text-999 word-wrap">
					关闭后无法收到个性化内容推荐
				</view>
			</view>
			<switch class="switch" :color="is_open?addRadioColor:addRadioDefaultColor" @change="handleSwitch"
				:checked="is_open ? true : false"></switch>

		</view>

		<!-- 网络监测 start -->
		<fu-notwork></fu-notwork>
		<!-- 网络监测 end -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				body: ' ', //协议内容
				is_open: false, // 是否开启企业订单审核
				addRadioColor: '#00A0E9',
				addRadioDefaultColor: '#bfbfbf'
			};
		},
		onLoad(options) {
			this.is_open = uni.getStorageSync('personalized')
			uni.setNavigationBarTitle({
				title:global.i18n['个性化推荐设置']
			})
		},

		methods: {

			/* @func 切换是否为开启
			 */
			handleSwitch(e) {
				this.is_open = e.detail.value;
				uni.setStorageSync('personalized',this.is_open)
				return
				this.$util.throttle(() => {
					this.$api.post(global.apiUrls.postIsOpenExamine).then(res => {
						if (res.data.code == 1) {
							this.is_open = e.detail.value;
							// this.$message.info(res.data.msg)
						} else {
							this.$message.info(res.data.msg)
						}
					})
				}, 2000)

			},
			/**
			 * @description 获取协议内容
			 * @param {Object} id = 15（用户协议） 23（隐私协议）
			 */
			getData() {
				this.isShowLoading = true
				this.$api.post(global.apiUrls.postOperationGetColumn, {
					category_id: 3,
				}).then(res => {
					this.isShowLoading = false
					var res = res.data
					if (res.code == 1) {
						this.body = richText.format(res.data.content);
					} else {
						this.body = ''
					}
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	// 页面内容 start
	.page {
		background: #f8f8f8;
		overflow: hidden;
		height: 100vh;
		overflow-y: scroll;
		line-height: 48rpx;
		font-size: 32rpx;
	}

	/deep/ .switch {
		transform: scale(0.7);
	}

	// 页面内容 end
</style>
